//
// Created by Zxy on 2021/7/1.
//

#include "Product.h"
#include <iostream>
using namespace std;


int main(){
    printf("简单工厂模式\n");
    Factory *fac = new Factory();
    AbstractProduct *product = nullptr;
    // 基类指针指向派生类对象
    product = fac->createProduct("Basketball");
    product->printName();
    product->play();
    delete product;

    product = fac->createProduct("Football");
    product->printName();
    product->play();
    delete product;

    product = fac->createProduct("Volleyball");
    product->printName();
    product->play();
    delete product;

    delete fac;
    return 0;
}